﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MallInteractiveMap.CMSWebClient.Common;
using MallInteractiveMap.CMSWebClient.Presenter;
using MallInteractiveMap.DTO;

namespace MallInteractiveMap.CMSWebClient.BasicView
{
    public partial class PhotoViewer : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ShowPhoto();
        }

        public int Id
        {
            get { return Request.QueryString["Id"] != null ? Convert.ToInt32(Request.QueryString["Id"]) : 0; }
        }

        private void ShowPhoto()
        {
            if(Id < 1)
            {
                Response.Write("No Image Found.");
                Response.End();
            }
            DTOShopPhotos photo = new ShopPresenter().GetPhotosById(Id);
            Response.ContentType = photo.FileType;
            Response.BinaryWrite(photo.ShopImage);
            Response.End();
        }
    }
}